<?php
require_once('../config/config.php');
require_once('../lib/facebook.php');
require_once('../classes/Utiles.php');
require_once '../classes/PDO_Mysql.php';
require_once '../classes/Utiles.php';
require_once '../classes/User.php';
require_once '../classes/User_Info.php';
require_once '../classes/User_Question.php';
require_once '../classes/User_Reponse.php';
require_once '../classes/User_Info.php';
require_once '../classes/Score.php';
require_once('../classes/FriendPlus.php');
//require_once('../classes/krumo/class.krumo.php');


//$fb = $_SESSION['FB'];
$fb = new FriendPlus(array(
       'appId'  => FB_APP_ID,
       'secret' => FB_SECRET_ID,
       'my_url' => FB_URL_CANEVAS,
       'cookie' => true,
));

$type_question = $_POST['qtype'];
$myfriends = $fb->getFriendsList($type_question);
$count = 5;

?>
<div id="menu"> 
    <div id="centre"></div>
    <ul>
        <?php
        $i = 1;
        shuffle($myfriends);
        foreach($myfriends as $friend) {
            echo '<li id="result' . $i . '" value="' . $i . '">
                    <span class="response_fid" style="display:none"></span>
                    <span class="fid" style="display:none">'.$friend['id'].'</span>
                    <span class="response">'.$friend['response'].'</span>
                </li>';
            $i++;
        }
        
        shuffle($myfriends);
        foreach($myfriends as $friend) {
            echo '<li id="item' . $i . '"  value="' . $i . '">
                    <span style="display:none" id="user'.$i.'">'.$friend['id'].'</span>
                    <img title="'.$friend['name'].'" src="https://graph.facebook.com/' . $friend["id"] .'/picture" width="40" height="40"/>
                </li>';
            $i++;
        }
        $i = 1;
        ?>
    </ul>
</div>

</div>

</div>